package com.ae.shield.client.gui;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import com.ae.shield.ModLib;
import com.ae.shield.common.gui.container.RubbishContainer;
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TranslationTextComponent;

public class RubbishScreen extends ContainerScreen<RubbishContainer> {
    private static final ResourceLocation GUI = new ResourceLocation(ModLib.MOD_ID, "textures/gui/rubbish_shield.png");

    public RubbishScreen(RubbishContainer rubbishContainer, PlayerInventory inventory, ITextComponent titleIn) {
        super(rubbishContainer, inventory, titleIn);
        guiLeft = 0;
        guiTop = 0;
        xSize = 175;
        ySize = 166;
    }

    @Override
    protected void drawGuiContainerBackgroundLayer(MatrixStack matrixStack, float partialTicks, int x, int y) {
        RenderSystem.color4f(1f, 1f, 1f, 1f);
        minecraft.textureManager.bindTexture(GUI);

        int x1 = (width - xSize) / 2;
        int y1 = (height - ySize) / 2;
        blit(matrixStack, x1, y1, 0, 0, xSize, ySize);
    }

    @Override
    public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
        renderBackground(matrixStack);
        super.render(matrixStack, mouseX, mouseY, partialTicks);
        renderHoveredTooltip(matrixStack, mouseX, mouseY);
    }

    @Override
    protected void drawGuiContainerForegroundLayer(MatrixStack matrixStack, int x, int y) {
        font.func_243248_b(matrixStack, playerInventory.getDisplayName(), (float) playerInventoryTitleX, (float) playerInventoryTitleY - 38, 4210752);
        font.func_243248_b(matrixStack, new TranslationTextComponent("screen.ae.shield.rubbish_shield.filter"), (float) playerInventoryTitleX, (float) playerInventoryTitleY - 67, 4210752);
    }
}
